home *** CD-ROM | disk | FTP | other *** search
/ What PC? 1996 August / WPCAUG96.ISO / multi / singing / shared.dxr / 01975_LAPTOP lingo.ls < prev    next >
Encoding:
Text File  |  1996-06-12  |  4.8 KB  |  228 lines

  1. on Black
  2.   return 255
  3. end
  4.  
  5. on InitDataRange
  6.   global dataFirst, dataLast
  7.   set dataFirst to the number of cast "A B A"
  8.   set dataLast to the number of cast "zur├╝ckhaltend"
  9. end
  10.  
  11. on MouseIsHot
  12.   global textSpr
  13.   if rollOver(textSpr) then
  14.     set w to the mouseWord
  15.     if w < 1 then
  16.       return 0
  17.       exit
  18.     end if
  19.     set TextCastNo to the castNum of sprite textSpr
  20.     set itsColour to the foreColor of word w of field TextCastNo
  21.     if itsColour = Black() then
  22.       return 0
  23.     else
  24.       return 1
  25.     end if
  26.   else
  27.     return 0
  28.   end if
  29. end
  30.  
  31. on LaptopRollOvers
  32.   if MouseIsHot() then
  33.     set n to the number of cast "Hand"
  34.     cursor([n, n + 1])
  35.   else
  36.     cursor(0)
  37.   end if
  38. end
  39.  
  40. on SpotSpr
  41.   return 40
  42. end
  43.  
  44. on LightOn
  45.   puppetSprite(SpotSpr(), 1)
  46.   set the locH of sprite SpotSpr() to the mouseH
  47.   set the locV of sprite SpotSpr() to the mouseV
  48.   updateStage()
  49. end
  50.  
  51. on LightOff
  52.   set the locH of sprite SpotSpr() to -100
  53.   updateStage()
  54. end
  55.  
  56. on OutOfRange wordno
  57.   global textSpr
  58.   set TextCastNo to the castNum of sprite textSpr
  59.   set nWords to the number of words in field TextCastNo
  60.   put wordno > nWords
  61.   return wordno > nWords
  62. end
  63.  
  64. on HotWord checkWord
  65.   global textSpr
  66.   set TextCastNo to the castNum of sprite textSpr
  67.   return the foreColor of word checkWord of field TextCastNo = Blue()
  68. end
  69.  
  70. on GetWord wordno
  71.   global textSpr
  72.   set TextCastNo to the castNum of sprite textSpr
  73.   set theWord to word wordno of field TextCastNo
  74.   return theWord
  75. end
  76.  
  77. on KillEndSplitter theWord
  78.   delete char -30000 of theWord
  79.   if the last char in theWord = "'" then
  80.     delete char -30000 of theWord
  81.   end if
  82.   return theWord
  83. end
  84.  
  85. on EndsWithSplitter theWord
  86.   set testChar to the last char in theWord
  87.   if getPos([".", ",", ";", "'", ")"], testChar) > 0 then
  88.     return 1
  89.     exit
  90.   else
  91.     if testChar = "s" then
  92.       set wordCopy to theWord
  93.       delete char -30000 of wordCopy
  94.       set CheckAlso to the last char in wordCopy
  95.       if CheckAlso = "'" then
  96.         return 1
  97.         exit
  98.       else
  99.         return 0
  100.         exit
  101.       end if
  102.     end if
  103.   end if
  104. end
  105.  
  106. on KillStartSplitter theWord
  107.   delete char 1 of theWord
  108.   return theWord
  109. end
  110.  
  111. on StartsWithSplitter theWord
  112.   set testChar to char 1 of theWord
  113.   if testChar = "(" then
  114.     return 1
  115.     exit
  116.   end if
  117.   return 0
  118. end
  119.  
  120. on GetPhrase
  121.   global gMouseWord
  122.   set thePhrase to EMPTY
  123.   set subPhrase1 to EMPTY
  124.   if not StartsWithSplitter(GetWord(gMouseWord)) then
  125.     set lookAt to gMouseWord - 1
  126.     repeat while 1
  127.       if lookAt = 0 then
  128.         exit repeat
  129.       end if
  130.       if not HotWord(lookAt) then
  131.         exit repeat
  132.       end if
  133.       set theWord to GetWord(lookAt)
  134.       if EndsWithSplitter(theWord) then
  135.         exit repeat
  136.       end if
  137.       set subPhrase1 to theWord && subPhrase1
  138.       if StartsWithSplitter(theWord) then
  139.         exit repeat
  140.       end if
  141.       set lookAt to lookAt - 1
  142.     end repeat
  143.   end if
  144.   if the last char in subPhrase1 = " " then
  145.     delete char -30000 of subPhrase1
  146.   end if
  147.   set lookAt to gMouseWord
  148.   repeat while 1
  149.     set theWord to GetWord(lookAt)
  150.     set subPhrase2 to subPhrase2 && theWord
  151.     if EndsWithSplitter(theWord) then
  152.       exit repeat
  153.     end if
  154.     set lookAt to lookAt + 1
  155.     if OutOfRange(lookAt) then
  156.       exit repeat
  157.     end if
  158.     if not HotWord(lookAt) then
  159.       exit repeat
  160.     end if
  161.     set nextWord to GetWord(lookAt)
  162.     if StartsWithSplitter(nextWord) then
  163.       exit repeat
  164.     end if
  165.   end repeat
  166.   if char 1 of subPhrase2 = " " then
  167.     delete char 1 of subPhrase2
  168.   end if
  169.   set thePhrase to subPhrase1 && subPhrase2
  170.   if EndsWithSplitter(thePhrase) then
  171.     set thePhrase to KillEndSplitter(thePhrase)
  172.     if EndsWithSplitter(thePhrase) then
  173.       set thePhrase to KillEndSplitter(thePhrase)
  174.     end if
  175.   end if
  176.   if char 1 of thePhrase = " " then
  177.     delete char 1 of thePhrase
  178.   end if
  179.   if StartsWithSplitter(thePhrase) then
  180.     KillStartSplitter(thePhrase)
  181.   end if
  182.   return thePhrase
  183. end
  184.  
  185. on LapTopClick
  186.   global textSpr, FirstCast, lastArticle, returnPhrase, gMouseWord
  187.   set gMouseWord to the mouseWord
  188.   if MouseIsHot() then
  189.     LightOn()
  190.     repeat while the mouseDown
  191.       nothing()
  192.     end repeat
  193.     LightOff()
  194.     WatchCursor()
  195.     set mousePhrase to GetPhrase()
  196.     put mousePhrase
  197.     set newarticle to phraseLookUp(mousePhrase)
  198.     if newarticle > 0 then
  199.       set the castNum of sprite textSpr to newarticle
  200.       updateStage()
  201.       StepOn(the name of cast newarticle, newarticle)
  202.     else
  203.       beep()
  204.     end if
  205.   end if
  206. end
  207.  
  208. on KillLaptopPuppets
  209.   repeat with i = 32 to 40
  210.     puppetSprite(i, 0)
  211.   end repeat
  212. end
  213.  
  214. on CloseLaptop
  215.   puppetSprite(the clickOn, 1)
  216.   set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  217.   updateStage()
  218.   repeat while the mouseDown
  219.   end repeat
  220.   puppetSprite(the clickOn, 0)
  221.   updateStage()
  222.   KillLaptopPuppets()
  223. end
  224.  
  225. on PreLoadLaptop
  226.   preLoadCast("laptop First", "laptop last")
  227. end
  228.